<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
require_once('../includes/connect.php');
require_once('../includes/functions.php');

mysql_select_db($database, $databaseConnect);

// get navigation options
$getNavOpt = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'navOptions'");
$navOpt = mysql_fetch_assoc($getNavOpt);
$navOpt = explode(":", $navOpt['value']);

// get website title
$getWebTitle = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'adWebTitle'");
$webTitle = mysql_fetch_assoc($getWebTitle);
// get website strapline
$getWebStrap = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'adWebStrap'");
$webStrap = mysql_fetch_assoc($getWebStrap);
// get install directory
$getInstallDir = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'installDir'");
$installDir = mysql_fetch_assoc($getInstallDir);


// news listing
$getNews = mysql_query("SELECT * FROM affiliSt_news ORDER BY timestamp DESC,id DESC LIMIT 0, 5");
$newsItemsFeedAll = mysql_fetch_assoc($getNews);
//header("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">';
?>


<channel>

<title><?php echo $webTitle['value'].' News'; ?></title>
<description><?php echo $webStrap['value']; ?></description>
<link><?php echo $installDir['value']; ?></link>

<?php do { ?>

<item>
<title><?php echo $newsItemsFeedAll['name']; ?></title>
<description><?php echo substr(strip_tags($newsItemsFeedAll['content']), 0, 150).'...'; ?></description>
<link><?php 
if ($navOpt[7] == 1) {
// html perma
echo $installDir['value'].'newsitem/'.$newsItemsFeedAll['id'].'/'.urltxt($newsItemsFeedAll['name']).'.html';
} else {
// php link
echo $installDir['value'].'index.php?case=newsitem&npag='.$newsItemsFeedAll['id'];
} ?></link>
</item>

<?php } while ($newsItemsFeedAll = mysql_fetch_assoc($getNews)); ?>



</channel>

</rss>